class HashTable {
    constructor() {
        this.table = [];
    }

    // 对载入数据的预处理
    static loseloseHashCode(key) {
        let hash = 0;
        for (let i = 0; i < key.length; i++) {
            hash += key.charCodeAt(i);
        }
        return hash % 37;
    }

    // put 添加数据
    put(key, value) {
        let position = HashTable.loseloseHashCode(key);
        console.log(position+'-'+key);
        this.table[position] = value;
    }

    // get 获取数据
    get(key){
        return this.table[HashTable.loseloseHashCode(key)]
    }

    // remove 移除数据
    remove(key){
        let temp = this.get(key);
        this.table[HashTable.loseloseHashCode(key)] = undefined;
        return temp;
    }

    // print 输出数据
    print(){
        for (let i = 0; i < this.table.length; i++) {
           if(this.table[i]){
               console.log(i+':'+this.table[i]);
           }
        }
    }
}